/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "scactbinstru")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Scactbinstru.findAll", query = "SELECT s FROM Scactbinstru s"),
    @NamedQuery(name = "Scactbinstru.findByScactbinstruid", query = "SELECT s FROM Scactbinstru s WHERE s.scactbinstruid = :scactbinstruid"),
    @NamedQuery(name = "Scactbinstru.findByNombre", query = "SELECT s FROM Scactbinstru s WHERE s.nombre = :nombre"),
    @NamedQuery(name = "Scactbinstru.findByIdorganismo", query = "SELECT s FROM Scactbinstru s WHERE s.idorganismo = :idorganismo")})
public class Scactbinstru implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "scactbinstruid")
    private Integer scactbinstruid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idorganismo")
    private int idorganismo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "scactbinstruid")
    private Collection<Scactbindica> scactbindicaCollection;

    public Scactbinstru() {
    }

    public Scactbinstru(Integer scactbinstruid) {
        this.scactbinstruid = scactbinstruid;
    }

    public Scactbinstru(Integer scactbinstruid, String nombre, int idorganismo) {
        this.scactbinstruid = scactbinstruid;
        this.nombre = nombre;
        this.idorganismo = idorganismo;
    }

    public Integer getScactbinstruid() {
        return scactbinstruid;
    }

    public void setScactbinstruid(Integer scactbinstruid) {
        this.scactbinstruid = scactbinstruid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public int getIdorganismo() {
        return idorganismo;
    }

    public void setIdorganismo(int idorganismo) {
        this.idorganismo = idorganismo;
    }

    @XmlTransient
    public Collection<Scactbindica> getScactbindicaCollection() {
        return scactbindicaCollection;
    }

    public void setScactbindicaCollection(Collection<Scactbindica> scactbindicaCollection) {
        this.scactbindicaCollection = scactbindicaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (scactbinstruid != null ? scactbinstruid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Scactbinstru)) {
            return false;
        }
        Scactbinstru other = (Scactbinstru) object;
        if ((this.scactbinstruid == null && other.scactbinstruid != null) || (this.scactbinstruid != null && !this.scactbinstruid.equals(other.scactbinstruid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Scactbinstru[ scactbinstruid=" + scactbinstruid + " ]";
    }
    
}
